<template>
  <!-- 动态加载配置 -->
  <el-card class="dynamic-config" :body-style="{ padding: '10px 0' }">
    <el-empty v-if="!dynamicComponentConfig" description="暂无模板" />
    <component
      :is="dynamicComponentConfig"
      v-bind="{ ...$attrs, ...$props }"
      v-on="$listeners"
    />
  </el-card>
</template>

<script>
import template from '@/mixins/template'
import Templates from '@/components/Templates'

export default {
  mixins: [template],

  computed: {
    dynamicComponentConfig() {
      if (this.tempInfos.template) {
        return Templates[this.tempInfos.template]['Config']
      } else {
        return false
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.dynamic-config {
  border: none;
}
</style>
